package com.black.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.black.dao.WellInitParamDao;
import com.black.response.ResponseData;
import com.black.service.WellInitParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/BaseData/WellInitParam")
public class WellInitParamController {

    @Autowired
    WellInitParamService wellInitParamService;
    @Resource
    WellInitParamDao wellInitParamDao;
    @GetMapping("")
    public Object loadPage( Integer currentPage){
        return "success";
//        System.out.println("页数是"+currentPage);
//        System.out.println("我被访问了");
//        Page page = wellInitParamDao.selectPage(new Page(currentPage, 10), null);
//        return new ResponseData(page.getRecords()).getData();
    }
    @GetMapping("getTotal")
    public Object getTotal(){
        return wellInitParamDao.selectCount(null);
    }

    @GetMapping("/getWellsByLayer/{layerNum}")
    public ResponseData getWellsByLayer(@PathVariable(name = "layerNum") Integer layerNum){
        try{
            return ResponseData.ok(wellInitParamService.getWellsByLayer(layerNum));
        } catch (Exception e){
            return ResponseData.fail(e.getMessage());
        }
    }


}
